import { CitiesSearch, CountriesSearch } from "@/types/loaction";
import { request } from "umi";

// 获取城市列表
export async function getCitiesList(params: CitiesSearch) {
  return request('/api/cities/list', {
    method: 'GET',
    params,
  });
}
/**
 * 获取国家列表
 * @param params 
 * @returns 
 */
export async function getCountriesList(params: CountriesSearch) {
  return request('/api/countries/list', {
    method: 'GET',
    params,
  });
}
/**
 * 获取国家详细信息
 * @param params 
 * @returns 
 */
export async function getCountriesDetail(params: { cname: string }) {
  return request('/api/countries', {
    method: 'GET',
    params,
  });
}
/**
 * 获取城市详细信息
 * @param params 
 * @returns 
 */
export async function getCityDetail(params: { cname: string }) {
  return request('/api/cities', {
    method: 'GET',
    params,
  });
}
/**
 * 根据国家名称获取城市（不分页）
 * @param params 
 * @returns 
 */
export async function getCityByCountry(params: { country: string }) {
  return request('/api/cities/get_city_list', {
    method: 'GET',
    params,
  });
}